package com.yao.common;

import java.util.Arrays;
import java.util.List;

import com.yao.entity.Dish;
import com.yao.entity.Trader;
import com.yao.entity.Transaction;

/**
 * 启动初始化数据
 * @Description: TODO(用一句话描述该文件做什么) 
 * @author yaoym
 * @date 2018年2月9日 上午10:37:13 
 * @version V1.0
 */
public class Startup {

	static List<Transaction> transactions;
	static List<Dish> menu;

	/**
	 * 数据初始化
	 */
	static {
		//初始化交易员和交易对象
		initTransactions();
		
		//初始化菜单
		initMenu();
	}

	private static void initTransactions() {
		Trader raoul = new Trader("Raoul", "Cambridge");
		Trader mario = new Trader("Mario", "Milan");
		Trader alan = new Trader("Alan", "Cambridge");
		Trader brian = new Trader("Brian", "Cambridge");

		transactions = Arrays.asList(
				new Transaction(brian, 2011, 300),
				new Transaction(raoul, 2012, 1000), 
				new Transaction(raoul, 2011, 400),
				new Transaction(mario, 2012, 710), 
				new Transaction(mario, 2012, 700), 
				new Transaction(alan, 2012, 950)
				);
	}
	
	
	
	private static void initMenu() {
		menu = Arrays.asList(
				new Dish("pork", false, 800, Dish.Type.MEAT), 
				new Dish("beef", false, 700, Dish.Type.MEAT),
				new Dish("chicken", false, 400, Dish.Type.MEAT), 
				new Dish("french fries", true, 530, Dish.Type.OTHER),
				new Dish("rice", true, 350, Dish.Type.OTHER), 
				new Dish("season fruit", true, 120, Dish.Type.OTHER),
				new Dish("pizza", true, 550, Dish.Type.OTHER), 
				new Dish("prawns", false, 300, Dish.Type.FISH),
				new Dish("salmon", false, 450, Dish.Type.FISH));
	}



	public static List<Transaction> getTransactions() {
		return transactions;
	}
	
	public static List<Dish> getMenu() {
		return menu;
	}

}
